package chp11;

public class GameMaster {

    /**
     *
     * @param myFist 玩家的出拳
     * @param compFist 电脑的出拳
     * @return 1:玩家赢了 0:平手 -1:电脑赢了
     */
    public int check(int myFist, int compFist){
        //比较胜负
        int result = 0;
        if (myFist == compFist) {
            System.out.println("结果：平手");
            result = 0;
        } else if (myFist == 1 && compFist == 3 || myFist == 2 && compFist == 1 || myFist == 3 && compFist == 2) {
            System.out.println("结果：你赢了");
            result = 1;
        } else {
            System.out.println("结果：你输了");
            result = -1;
        }
        return result;
    }
}